from matplotlib.pylab import *

if __name__=='__main__':
    x = linspace(-4,4,2000)
    f1 = pow(10,x)
    f2 = pow(e,x)
    f3 = pow(2,x)
    plot(x, f1, 'r', x, f2, 'b', x, f3, 'g', linewidth=2)
    axis([-4, 4, 0.5, 8])
    text(1, 7.5, r'$10^x$', fontsize=16)
    text(2.2, 7.5, r'$e^x$', fontsize=16)
    text(3.2, 7.5, r'$2^x$', fontsize=16)
    title('A simple example', fontsize=16)
    
    savefig('sample_img.pdf', dpi=120)
    savefig('sample_img.png', dpi=120)
    
    show()
    